import Vue from 'vue'
import App from './App.vue'
import router from './router'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import VueAxios from 'vue-axios'
import Cookies from 'js-cookie'
import instance from './http/htttp.js'
import tinymce from 'tinymce/tinymce'
import permission from './assembly/insert.js'
Vue.directive("insert",permission)

import echarts  from 'echarts';
Vue.prototype.$echarts = echarts
Vue.use(VueAxios, axios)
Vue.use(ElementUI);
Vue.config.productionTip = false


import store from './store.js'
import i18n from './i18n/i18n.js'
// Vue.use(VueI18n)


router.beforeEach((to,from,next) =>{
	if(Cookies.get("AdminToken") || to.path == "/About"){
		// axios.defaults.headers.common["AdminToken"] = Cookies.get("AdminToken")
		
		next()
	}else{
		next({
			path:"/About",
			query: {
				order: to.path
			}
		})
	}
})
Vue.prototype.$instance = instance;
window.app = new Vue({
	router,
	store,
	i18n,// 不要忘记
	render: h => h(App)
}).$mount('#app')
